/**
 * 获取token
 */
export const getToken = () => {
  const token = localStorage.getItem('TOKEN')
  if (token) {
    return token
  }
  return ''
}

/**
 * 清空token
 */
export const clearToken = () => {
  localStorage.removeItem('TOKEN')
}

/**
 * 设置token
 */
export const setToken = (token: string) => {
  localStorage.setItem('TOKEN', token)
}

/**
 * 获取用户信息
 */
export const getUserInfo = () => {
  return JSON.parse(localStorage.getItem('USER_INFO') || '{}')
}

/**
 * 清空用户信息
 */
export const clearUserInfo = () => {
  localStorage.removeItem('USER_INFO')
}

/**
 * 设置用户信息
 */
export const setUserInfo = (user: any) => {
  localStorage.setItem('USER_INFO', JSON.stringify(user))
}
